package com.fengxu.gamescript.ui.main.mode

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.fengxu.gamescript.ui.main.mode.doc.DocFragment
import com.fengxu.gamescript.ui.main.mode.file.FileFragment
import com.fengxu.gamescript.ui.main.mode.msg.MsgFragment

/**
 * tab栏Fragment适配器
 */
class TabFragmentAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {

    val fileFragment:FileFragment by lazy { FileFragment() }
    val docFragment: DocFragment by lazy { DocFragment() }
    val msgFragment:MsgFragment by lazy { MsgFragment() }

    private val fragmentList = listOf(fileFragment,docFragment,msgFragment)

    override fun getCount(): Int {
        return fragmentList.size
    }

    override fun getItem(position: Int): Fragment {
        return fragmentList[position]
    }
}